<%@page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="html" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<html:header title="借入单打印">

    <style media="print">
        @page {
            margin: 0mm; /* this affects the margin in the printer settings */
            size: landscape;
        }
    </style>

    <style>
        table{border-collapse: collapse;width: 100%}
        table td, table th{border: 1px solid #000000;}
        table td{padding:4px 0 4px 4px;}
        table td, table th{border: 1px solid #000000;}
        span,div,td,th{font-size:14px;}
    </style>

    <script>
        function printPage(data){
            let $printDiv = $("#printDiv");
            $printDiv.empty();

            genPage(data,$printDiv);

            setTimeout(function () {
                window.print();
            },100);
        }

        function genPage(data,$printDiv){
            genPrintDiv($printDiv, data.id, "借入单", data.no);
            let beforeList = [];
            beforeList.push({label:"供应商", content:data.provider.name});
            beforeList.push({label:"经办人", content:data.user.name});
            beforeList.push({width:180, label: "业务日期", content: GMTToDate(data.date)});
            beforeList.push({width:180, label: "预计归还日期", content: GMTToDate(data.backDate)});
            beforeList.push({width:0,label:"入库仓库", content:data.houseVo.store.name+">"+data.houseVo.name});
            genPrintLine($('#'+data.id+' .before'), beforeList);

            let endList = [];
            endList.push({width:0, newLine: true,label:"备注", content:data.remark});
            endList.push({label:"制单人", content:data.makeUser.name});
            endList.push({width:0, label:"制单时间", content:data.makeTime});
            genPrintLine($('#'+data.id+' .end'), endList);

            let list=[];
            $.each(data.borrowInGoodsVoList, function (i,vo) {
                let data={};
                data.index = (i+1);
                data.no = vo.goodsVo.no;
                data.name = vo.goodsVo.name;
                data.norms = genGoodsNorm(vo.norms);
                data.unit = genUnitName(vo.goodsVo.goodsUnitVoList, vo.unitId);
                data.price = getPrice(vo.price);
                data.number = vo.number;
                data.amount = getPrice(vo.amount);
                list.push(data);
            });

            genPrintTable($('#'+data.id+' .table'), ['序号','商品编号','商品名称','规格','单位','单价','数量','金额'],list);
        }

    </script>

</html:header>
<body>
<div id="printDiv">
</div>
</body>
</html>